package com.tekj.cxqcb.view.Module.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tekj.cxqcb.R;
import com.tekj.cxqcb.operation.resultBean.SelectExpandListBean;
import com.tekj.cxqcb.operation.resultBean.SelectExpandOrderListBean;

import java.util.List;

/**
 * 所有渠道订单列表
 */
public class AllOrderAdapter extends BaseQuickAdapter<SelectExpandOrderListBean.DataBean.ListBean, BaseViewHolder> {

    String types[] = {"已关闭", "待支付", "进行中", "已完成"};

    public AllOrderAdapter(@Nullable List<SelectExpandOrderListBean.DataBean.ListBean> data) {
        super(R.layout.item_all_orders, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectExpandOrderListBean.DataBean.ListBean item) {
        helper.setText(R.id.tv_name, item.getName());

        helper.setText(R.id.tv_phone, item.getPhone());

        helper.setText(R.id.tv_name2, item.getSalesName());

        helper.setText(R.id.tv_phone2, item.getPhone());

        helper.setText(R.id.tv_car_name, item.getCarName());

        helper.setText(R.id.tv_type, types[item.getOrderStatus()]);
        int color;
        if (item.getOrderStatus() == 1) {
            color = R.color.color_eb7025;
        } else if (item.getOrderStatus() == 2) {
            color = R.color.colorPrimary;
        } else {
            color = R.color.drop_down_unselected2;
        }

        helper.setTextColor(R.id.tv_type,
                mContext.getResources().getColor(color));


        helper.setText(R.id.tv_time, item.getCreateTime());
    }
}
